const express = require('express')
const admin = express.Router()

admin.get('/', (req, res) => {
        // res.send('管理界面')
        res.redirect('/admin/login')
    })
// 登录
admin.get('/login', require('./admin/loginPage'))
// 登录验证
admin.post('/login',require('./admin/login'))
// 退出登录
admin.get('/loginout',require('./admin/loginOut'))
    // 用户查询
admin.get('/user', require('./admin/user'))
admin.get('/user-add',require('./admin/userEditPage'))
// 添加用户
admin.post('/user-add',require('./admin/user-add'))
    // 用户编辑
admin.get('/user-edit', require('./admin/userEditPage'))
// 修改用户资料
admin.post('/user-edit', require('./admin/user-edit'))
// 删除用户
admin.get('/delete',require('./admin/user-delete'))
    // 文章查询
admin.get('/article', require('./admin/article'))
    // 文章新增
admin.get('/article-add', require('./admin/articleEditPage'))
admin.post('/article-add',require('./admin/article-add'))
// 文章修改
admin.get('/article-edit',require('./admin/articleEditPage'))
admin.post('/article-edit',require('./admin/article-edit'))

// 删除文章
admin.get('/article-delete',require('./admin/article-delete'))

module.exports = admin
